package com.ghy.entity;

import com.mybatisflex.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单表 实体类。
 *
 * @author ghy
 * @since 2024-12-22
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "order", schema = "ml_oms")
public class Order implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 编号
     */
    private String sn;

    /**
     * 总金额
     */
    private Double totalAmount;

    /**
     * 实际支付总金额
     */
    private Double payAmount;

    /**
     * 支付方式,0未支付,1微信,2支付宝,3其他
     */
    private Integer payType;

    /**
     * 订单状态,0未付款,1已付款,2已取消,3其他
     */
    private Integer status;

    /**
     * 用户ID
     */
    private Long fkUserId;

    /**
     * 收货人账号
     */
    private String username;

    /**
     * 优惠券ID
     */
    private Long fkCouponsId;

    /**
     * 描述
     */
    private String info;

    /**
     * 数据版本
     */
    @Column(version = true)
    private Long version;

    /**
     * 逻辑删除,0未删除,1已删除
     */
    @Column(isLogicDelete = true)
    private Integer deleted;

    /**
     * 创建时间
     */
    private LocalDateTime created;

    /**
     * 修改时间
     */
    private LocalDateTime updated;

    @RelationOneToMany(selfField = "id", targetField = "fkOrderId")
    private List<OrderDetail> orderDetails;



}
